/**
 * Description:
 * Class Name:WriteObject
 * Date:2022/5/2 18:08
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第15章_输入输出._15_8_Java9改进的对象序列化._15_8_2_使用对象流实现序列化;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class WriteObject {
    public static void main(String[] args) {
        try (
                var oos = new ObjectOutputStream(new FileOutputStream("Chapter_15_8_object.txt"))
                ){
            var per = new Person("孙悟空", 500);
            oos.writeObject(per);
        }
        catch (IOException ioException){
            ioException.printStackTrace();
        }
    }
}
